home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9317 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  53 lines

  1. Newsgroups: comp.lang.c
  2. Path: peer-news.britain.eu.net!info!news
  3. From: Matthew Gibbons <m.h.gibbons@swansea.ac.uk>
  4. Subject: Division problem
  5. X-Nntp-Posting-Host: faith.swan.ac.uk
  6. Content-Type: text/plain; charset=us-ascii
  7. Message-ID: <3141571F.41C67EA6@swansea.ac.uk>
  8. Sender: news@info.swan.ac.uk
  9. Content-Transfer-Encoding: 7bit
  10. Organization: Swansea News Server
  11. Mime-Version: 1.0
  12. Date: Sat, 9 Mar 1996 10:02:07 GMT
  13. X-Mailer: Mozilla 2.0 (X11; I; SunOS 4.1.3 sun4m)
  14.  
  15. Hi,
  16.  
  17. I have a little problem that I can't seem to solve. Any help would be
  18. greatly appreciated...
  19.  
  20. I have a 64 bit number (grabbed from an external clock source) which
  21. I need to be able to divide by a given factor, replacing the original
  22. number with the quotient, and returning the remainder.
  23.  
  24. The 64 bit number is of this type:
  25.  
  26.     typedef struct {
  27.         unsigned char ssr[8];
  28.         } gtime_t;
  29.  
  30. The MSB of this number being ssr[7].
  31.  
  32. I want to be able to call a function, say 'divgtime', thus:
  33.  
  34.     gtime_t   gt;
  35.     unsigned  rem;
  36.  
  37.     :
  38.  
  39.     // divide the time by 1000
  40.     rem = divgtime(>, 1000);
  41.  
  42.     :
  43.  
  44. Where 1000 is the desired factor.
  45.  
  46. I have tried lots of ways of doing this division, but to no avail.
  47.  
  48. Can anyone help me? If you can, please could you email me, as my news
  49. link is very slow in updating.
  50.  
  51. Thanks in advance,
  52. Matthew
  53.